﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Booking_Hotel.DBML;

namespace Booking_Hotel.DAL
{
    public class Supplier_KhuyenMaiDAO
    {
        ThanhBHotelDataContext tbk = new ThanhBHotelDataContext();

        public void addSupplier_Hotel_KhuyenMai(Supplier_Hotel_KhuyenMai shk)
        {
            Supplier_Hotel_KhuyenMai add = new Supplier_Hotel_KhuyenMai()
            {
                Supplier_HotelID = shk.Supplier_HotelID,
                TieuDeKhuyenMai = shk.TieuDeKhuyenMai,
                NoiDungKhuyenmai = shk.NoiDungKhuyenmai,
                NgayBatDauDang = shk.NgayBatDauDang,
                NgayKetThucDang = shk.NgayKetThucDang
            };
            tbk.Supplier_Hotel_KhuyenMais.InsertOnSubmit(add);
            tbk.SubmitChanges();
        }

        public void updateSupplier_Hotel_KhuyenMai(Supplier_Hotel_KhuyenMai shk)
        {
            Supplier_Hotel_KhuyenMai update = tbk.Supplier_Hotel_KhuyenMais.Single(ca => ca.Supplier_Hotel_KhuyenMaiID == (int)shk.Supplier_Hotel_KhuyenMaiID);
            {
                update.Supplier_Hotel_KhuyenMaiID = shk.Supplier_Hotel_KhuyenMaiID;
                update.Supplier_HotelID = shk.Supplier_HotelID;
                update.TieuDeKhuyenMai = shk.TieuDeKhuyenMai;
                update.NoiDungKhuyenmai = shk.NoiDungKhuyenmai;
                update.NgayBatDauDang = shk.NgayBatDauDang;
                update.NgayKetThucDang = shk.NgayKetThucDang;
            }
            tbk.SubmitChanges();
        }
    }
}